package com.idnx.mynewsdemo.http;

import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

public class ApiServiceManager {
    private Retrofit mRetrofit;
    private static ApiServiceManager mInstance = new ApiServiceManager();
    public static ApiServiceManager get() {
        return mInstance;
    }
    private ApiServiceManager() {
    }

    public <T> T create(final Class<T> service, String url) {
        mRetrofit = new Retrofit.Builder()
                .baseUrl(url)
                .addConverterFactory(GsonConverterFactory.create())
                .build();
        return mRetrofit.create(service);
    }

    public Retrofit getRetrofit() {
        return mRetrofit;
    }
}
